<?php
$page_title = 'eTAT';
$style = 'addgroup';
require_once 'controller.php';

if($params->g != '') {
	$group = $instructor->getGroup($params->g);
	$course = $group->getCourse();
	$students = $group->getAllStudents();
} else {
	redirect('home.php');
}

require_once 'header.php';
?>
<h1><?php print anchor('home.php','Home').' > '.anchor("course.php?c=$course->id",$course->title).' > '.$group->name ?></h1>

<div id='parser-update-data' class='invisible'><?php print $group->id; ?></div>
<h3>Students:</h3>
<?php
if(isset($students)) {
	foreach($students as $s) {
		print "<div id='$s->id'>";
		print "$s->full_name (<a href='mailto:$s->email'>$s->email</a>)<ul class='indent'>";
		print "<li>SVN Commits: {$s->getSVNCount()}</li> 
			<li>Wiki Updates: {$s->getWikiCount()}</li>
			<li>Forum Posts: {$s->getForumCount()}</li>
			<li>Files: {$s->getFileCount()}</li>
			<li>Issue Tracker Updates: {$s->getIssueCount()}</li>";
		print '</ul></div>';
	}
	print '</ul>';
	print newBtn('refresh','Update Feeds',array('type'=>'button','onclick'=>"updateGroupFeeds(&#39;refresh&#39;,&#39;$group->id&#39;)"));
} else {
?>
<p>Looks like you haven't added any students to this group.</p>
<br>
<p>You can leave it to us to automatically fetch students as we parse your project feeds.</p>
<p>OR</p>
<p>You could choose one of the options below:</p><br>
<?php
$form = new Form('add_student_form','post');
$form->divStart('option1',array('class'=>'left'));
$form->text('<p>Option 1</p><br>');
$form->text('<p>You can type in the Full Name and Gmail Address of each student yourself (if you have the information)</p>');
$form->button('option1_submit','Choose this',array('type'=>'submit'));
$form->text('<br><p>Option 2</p><br>');
$form->text('<p>You can upload a CSV file carrying the Full Name and Gmail Address of the students (if you have it in a CSV file)</p>');
$form->button('option2_submit','Choose this',array('type'=>'submit'));
$form->divEnd();
$form->divStart('option2',array('class'=>'left'));
$form->text('<p>Option 3</p><br>');
$form->text('<p>You can send an email asking all your students to fill in their data themselves.You will need to enter their email addresses for this.</p>');
$form->button('option3_submit','Choose this',array('type'=>'submit'));
$form->text('<br><p>Option 4</p><br>');
$form->text('<p>We have developed a learning model which will try to populate the Group Students
			as the project updates keep coming into eTAT. This option might be a little inaccurate, though.</p>');
$form->button('option4_submit','Choose this',array('type'=>'submit'));
$form->divEnd();
print $form->build();
}
?>

<div class='clear'></div>
<?php require_once 'footer.php'; ?>